package com.lanou.moving.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.lanou.moving.fragment.NewSongChinese;
import com.lanou.moving.fragment.NewSongJapanese;
import com.lanou.moving.fragment.NewSongKorean;
import com.lanou.moving.fragment.NewSongWestern;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 梁树珍 on 15/11/3.
 */
public class NewSongAdapter extends FragmentPagerAdapter {
    private List<Fragment> fragmentList;
    private String[] title= {"华语", "欧美", "韩语", "日语"};

    public NewSongAdapter(FragmentManager fm) {
        super(fm);
        init();
    }

    private void init(){
        fragmentList = new ArrayList<>();
        fragmentList.add(new NewSongChinese());
        fragmentList.add(new NewSongWestern());
        fragmentList.add(new NewSongKorean());
        fragmentList.add(new NewSongJapanese());
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return title.length;
    }
    public CharSequence getPageTitle(int position) {
        return title[position];
    }
}
